//word.cpp
#include "word.h"

word::word ()
{
	string = new char[strlen];
	length = 0;
}

word::word(char* s)
{
	string = new char[strlen];
	length = 0;
	while ((s[length] != '\0') && (length < strlen))
	{
		string[length] = s[length];
		length++;
	}
}

word::~word ()
{
	delete [] string;
}

word::word (const word& w)
{
	string = new char[strlen];
	length = w.length;
	int i;
	for (i = 0; i < length; i++)
		string[i] = w.string[i];
}

word& word::operator= (const word& w)
{
	delete [] string;
	string = new char[strlen];
	length = w.length;
	int i;
	for (i = 0; i < length; i++)
		string[i] = w.string[i];
  return *this;
}

void word::print ()
{
	int i;
	for (i = 0; i < length; i++)
		cout << string[i];
}

void word::println ()
{
	int i;
	for (i = 0; i < length; i++)
		cout << string[i];
	cout << endl;
}

